#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>

using namespace std;

int dx[8] = { 1 , 0 };
int dy[8] = { 0 , 1 };

int ret = 0;
int row, col, num;
vector<vector<bool>> check;

int wardrobeFinishing(int m, int n, int cnt) {
    row = m, col = n, num = cnt;

    check.resize(m, vector<bool>(n));

    dfs(0, 0);

    return ret;
}

void dfs(int i, int j)
{
    if (digit(i) + digit(j) > num)
        return;

    ret++;
    check[i][j] = true;

    for (int k = 0; k < 2; ++k)
    {
        int x = i + dx[k];
        int y = j + dy[k];
        if (x >= 0 && x < row && y >= 0 && y < col && check[x][y] == false)
            dfs(x, y);
    }
}

inline static int digit(int x)
{
    int cnt = 0;
    while (x)
    {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}

int main()
{

	return 0;
}